<%--
  Created by IntelliJ IDEA.
  User: ct
  Date: 2019/4/23
  Time: 17:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page import="java.util.Map" %>

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>首页</title>
</head>
<body>
<style type="text/css">
    .div1{
        width: 400px;
        margin: auto;
    }
</style>
<div class="div1">
<%
    Map<String,String> userName = (Map<String, String>) request.getSession().getAttribute("userName");
    if(userName == null) {
%>
<p>未检测到登录信息，请登录！！！</p>
<button><a href="/login/dgut">登陆</a></button>
<%
}else{
%>
<button><a href="/Servlet2">登出</a></button>
    <br><br>
<span> 用户信息</span>
<%
    }
%>
<br>
<table border="1">
<%

    if(userName != null)
    {
        for(String key : userName.keySet()){
            String value = userName.get(key);
           // out.println("<br>"+key+":"+value);
            out.println("<tr> <td>"+ key +"</td>" + "<td>"+value+"</td>");
        }
    }
%>
</table>
</div>
</body>
</html>